//
//  TouzhujiluVC.m
//  SSC
//
//  Created by 红沙尘 on 17/6/10.
//  Copyright © 2017年 红沙尘. All rights reserved.
//

#import "TouzhujiluVC.h"
#import "RMDateSelectionViewController.h"
#import "TouzhujiluCell.h"

@interface TouzhujiluVC ()

@end

@implementation TouzhujiluVC

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    return [super initWithNibName:NSStringFromClass([self.superclass class]) bundle:nibBundleOrNil];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitle:@"投注记录"];
}

#pragma mark - 网络数据

- (void)loadData{
    [super loadData];
    WeakSelf
    
    __weak UITableView *weakTableView = mainTableView;
    
    [SSCRequest userOrderListStartdt:[MTool formartDate:startField.text]
                               enddt:[MTool formartDate:endField.text]
                                page:page
                                type:CaipiaoTypeUnknow
                             success:^(NSDictionary *responseObject)
    {
        [weakTableView.mj_header endRefreshing];
        [weakTableView.mj_footer endRefreshing];
        [weakSelf loadWithArray:[NSString safeArray:responseObject[@"data"]]];
    } fail:^(NSError *error) {
        [weakTableView.mj_header endRefreshing];
        [weakTableView.mj_footer endRefreshing];
    }];
}

#pragma mark - IBAction

#pragma mark - table

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    TouzhujiluCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TouzhujiluCell"];
    
    [cell loadWithDict:dataArray[indexPath.row]];
    
    return cell;
}


#pragma mark - setup

- (void)setupData {
    //todo
    [super setupData];
}

- (void)setupUI {
    [super setupUI];
    
    mainTableView.rowHeight = 213;
    mainTableView.estimatedRowHeight = 213;
}


@end













